package com.centling.smartSealForPhone.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.centling.smartSealForPhone.R;

import java.util.List;

/**
 *
 * @author centling
 * @date 2016/9/28
 */
public class AuditorInfoAuthorityAdapter extends RecyclerView.Adapter<AuditorInfoAuthorityAdapter.AuthorityViewHolder> {

    private List<String> authority;
    private Context context;

    public AuditorInfoAuthorityAdapter(Context context, List<String> authority) {
        this.authority = authority;
        this.context = context;
    }

    @Override
    public AuthorityViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new AuthorityViewHolder(LayoutInflater.from(context)
                .inflate(R.layout.item_auditor_authority, parent, false));
    }

    @Override
    public void onBindViewHolder(AuthorityViewHolder holder, int position) {
        holder.textView.setText(authority.get(position));
    }

    @Override
    public int getItemCount() {
        return authority.size();
    }

    class AuthorityViewHolder extends RecyclerView.ViewHolder {
        TextView textView;

        AuthorityViewHolder(View itemView) {
            super(itemView);
            textView = itemView.findViewById(R.id.tv_auditor_authority);
        }
    }
}
